package com.ruoyi.datastatistics.service.impl;

import java.util.Arrays;
import java.util.List;

import com.ruoyi.framework.config.MonthTableNameHandler;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.datastatistics.mapper.V9HourEBeanMapper;
import com.ruoyi.datastatistics.domain.V9HourEBean;
import com.ruoyi.datastatistics.service.IV9HourEBeanService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
/**
 * 转存逐时Service业务层处理
 *
 * @author gdqt
 * @date 2025-11-21
 */
@Service
public class V9HourEBeanServiceImpl extends ServiceImpl<V9HourEBeanMapper, V9HourEBean> implements IV9HourEBeanService
{
    @Autowired
    private V9HourEBeanMapper v9HourEBeanMapper;

    /**
     * 查询转存逐时
     *
     * @param TagTime 转存逐时主键
     * @return 转存逐时
     */
    // @Override
    // public V9HourEBean selectV9HourEBeanByTagTime(Long TagTime)
    // {
    //
    //     return v9HourEBeanMapper.selectByTagTime(TagTime);
    // }

    /**
     * 查询转存逐时列表
     *
     * @param v9HourEBean 转存逐时
     * @return 转存逐时
     */
    @Override
    public List<V9HourEBean> selectV9HourEBeanList(V9HourEBean v9HourEBean)
    {
        if(ObjectUtils.isEmpty(v9HourEBean.getTagTime())){
            throw new RuntimeException("TagTime不能为空");
        }
        MonthTableNameHandler.setTagTime(v9HourEBean.getTagTime());
        LambdaQueryWrapper<V9HourEBean> queryWrapper = new LambdaQueryWrapper<>();
        if(v9HourEBean.getTagTime() != null){
            queryWrapper.eq(V9HourEBean::getTagTime,v9HourEBean.getTagTime());
        }
        if(v9HourEBean.getFirstVal() != null){
            queryWrapper.eq(V9HourEBean::getFirstVal,v9HourEBean.getFirstVal());
        }
        if(v9HourEBean.getLastVal() != null){
            queryWrapper.eq(V9HourEBean::getLastVal,v9HourEBean.getLastVal());
        }
        if(v9HourEBean.getMinVal() != null){
            queryWrapper.eq(V9HourEBean::getMinVal,v9HourEBean.getMinVal());
        }
        if(v9HourEBean.getMaxVal() != null){
            queryWrapper.eq(V9HourEBean::getMaxVal,v9HourEBean.getMaxVal());
        }
        if(v9HourEBean.getFirstTime() != null){
            queryWrapper.eq(V9HourEBean::getFirstTime,v9HourEBean.getFirstTime());
        }
        if(v9HourEBean.getLastTime() != null){
            queryWrapper.eq(V9HourEBean::getLastTime,v9HourEBean.getLastTime());
        }
        if(v9HourEBean.getMinTime() != null){
            queryWrapper.eq(V9HourEBean::getMinTime,v9HourEBean.getMinTime());
        }
        if(v9HourEBean.getMaxTime() != null){
            queryWrapper.eq(V9HourEBean::getMaxTime,v9HourEBean.getMaxTime());
        }
        if(!StringUtils.isEmpty(v9HourEBean.getDataValue())){
            queryWrapper.eq(V9HourEBean::getDataValue,v9HourEBean.getDataValue());
        }
        if(v9HourEBean.getMultiply() != null){
            queryWrapper.eq(V9HourEBean::getMultiply,v9HourEBean.getMultiply());
        }
        if(v9HourEBean.getInVal() != null){
            queryWrapper.eq(V9HourEBean::getInVal,v9HourEBean.getInVal());
        }
        if(v9HourEBean.getFirstVal1st() != null){
            queryWrapper.eq(V9HourEBean::getFirstVal1st,v9HourEBean.getFirstVal1st());
        }
        if(v9HourEBean.getFirstVal2nd() != null){
            queryWrapper.eq(V9HourEBean::getFirstVal2nd,v9HourEBean.getFirstVal2nd());
        }
        if(v9HourEBean.getFirstVal3rd() != null){
            queryWrapper.eq(V9HourEBean::getFirstVal3rd,v9HourEBean.getFirstVal3rd());
        }
        if(v9HourEBean.getFirstVal4th() != null){
            queryWrapper.eq(V9HourEBean::getFirstVal4th,v9HourEBean.getFirstVal4th());
        }
        if(v9HourEBean.getLastVal1st() != null){
            queryWrapper.eq(V9HourEBean::getLastVal1st,v9HourEBean.getLastVal1st());
        }
        if(v9HourEBean.getLastVal2nd() != null){
            queryWrapper.eq(V9HourEBean::getLastVal2nd,v9HourEBean.getLastVal2nd());
        }
        if(v9HourEBean.getLastVal3rd() != null){
            queryWrapper.eq(V9HourEBean::getLastVal3rd,v9HourEBean.getLastVal3rd());
        }
        if(v9HourEBean.getLastVal4th() != null){
            queryWrapper.eq(V9HourEBean::getLastVal4th,v9HourEBean.getLastVal4th());
        }
        if(v9HourEBean.getInterval() != null){
            queryWrapper.eq(V9HourEBean::getInterval,v9HourEBean.getInterval());
        }
        if(!StringUtils.isEmpty(v9HourEBean.getDataCfg())){
            queryWrapper.eq(V9HourEBean::getDataCfg,v9HourEBean.getDataCfg());
        }
        if(v9HourEBean.getChargVal() != null){
            queryWrapper.eq(V9HourEBean::getChargVal,v9HourEBean.getChargVal());
        }
        if(v9HourEBean.getCreateBy() != null){
            queryWrapper.eq(V9HourEBean::getCreateBy,v9HourEBean.getCreateBy());
        }
        if(v9HourEBean.getCreateDt() != null){
            queryWrapper.eq(V9HourEBean::getCreateDt,v9HourEBean.getCreateDt());
        }
        if(v9HourEBean.getUpdateBy() != null){
            queryWrapper.eq(V9HourEBean::getUpdateBy,v9HourEBean.getUpdateBy());
        }
        if(v9HourEBean.getUpdateDt() != null){
            queryWrapper.eq(V9HourEBean::getUpdateDt,v9HourEBean.getUpdateDt());
        }
        if(v9HourEBean.getFlag() != null){
            queryWrapper.eq(V9HourEBean::getFlag,v9HourEBean.getFlag());
        }
        if(v9HourEBean.getRaVal() != null){
            queryWrapper.eq(V9HourEBean::getRaVal,v9HourEBean.getRaVal());
        }
        if(v9HourEBean.getShareVal() != null){
            queryWrapper.eq(V9HourEBean::getShareVal,v9HourEBean.getShareVal());
        }
        return v9HourEBeanMapper.selectList(queryWrapper);
    }

    /**
     * 新增转存逐时
     *
     * @param v9HourEBean 转存逐时
     * @return 结果
     */
    @Override
    public int insertV9HourEBean(V9HourEBean v9HourEBean)
    {
        return v9HourEBeanMapper.insert(v9HourEBean);
    }

    /**
     * 修改转存逐时
     *
     * @param v9HourEBean 转存逐时
     * @return 结果
     */
    // @Override
    // public int updateV9HourEBean(V9HourEBean v9HourEBean)
    // {
    //     return v9HourEBeanMapper.updateByTagTime(v9HourEBean);
    // }

    /**
     * 批量删除转存逐时
     *
     * @param TagTimes 需要删除的转存逐时主键
     * @return 结果
     */
    // @Transactional
    // @Override
    // public int deleteV9HourEBeanByTagTimes(Long[] TagTimes)
    // {
    //     return v9HourEBeanMapper.deleteBatchTagTimes(Arrays.asList(TagTimes));
    // }

    /**
     * 删除转存逐时信息
     *
     * @param TagTime 转存逐时主键
     * @return 结果
     */
    // @Transactional
    // @Override
    // public int deleteV9HourEBeanByTagTime(Long TagTime)
    // {
    //     return v9HourEBeanMapper.deleteByTagTime(TagTime);
    // }
}
